3.4.90 \(\int \frac {\cos ^2(c+d x) (B \sec (c+d x)+C \sec ^2(c+d x))}{\sqrt {a+a \sec (c+d x)}} \, dx\) [390]

Optimal. Leaf size=119 \[ -\frac {(B-2 C) \text {ArcTan}\left (\frac {\sqrt {a} \tan (c+d x)}{\sqrt {a+a \sec (c+d x)}}\right )}{\sqrt {a} d}+\frac {\sqrt {2} (B-C) \text {ArcTan}\left (\frac {\sqrt {a} \tan (c+d x)}{\sqrt {2} \sqrt {a+a \sec (c+d x)}}\right )}{\sqrt {a} d}+\frac {B \sin (c+d x)}{d \sqrt {a+a \sec (c+d x)}} \]

[Out]

-(B-2*C)*arctan(a^(1/2)*tan(d*x+c)/(a+a*sec(d*x+c))^(1/2))/d/a^(1/2)+(B-C)*arctan(1/2*a^(1/2)*tan(d*x+c)*2^(1/
2)/(a+a*sec(d*x+c))^(1/2))*2^(1/2)/d/a^(1/2)+B*sin(d*x+c)/d/(a+a*sec(d*x+c))^(1/2)

________________________________________________________________________________________

Rubi [A]
time = 0.22, antiderivative size = 119, normalized size of antiderivative = 1.00, number of steps used = 7, number of rules used = 6, integrand size = 42, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.143, Rules used = {4157, 4107, 4005, 3859, 209, 3880} \begin {gather*} -\frac {(B-2 C) \text {ArcTan}\left (\frac {\sqrt {a} \tan (c+d x)}{\sqrt {a \sec (c+d x)+a}}\right )}{\sqrt {a} d}+\frac {\sqrt {2} (B-C) \text {ArcTan}\left (\frac {\sqrt {a} \tan (c+d x)}{\sqrt {2} \sqrt {a \sec (c+d x)+a}}\right )}{\sqrt {a} d}+\frac {B \sin (c+d x)}{d \sqrt {a \sec (c+d x)+a}} \end {gather*}

Antiderivative was successfully verified.

[In]

Int[(Cos[c + d*x]^2*(B*Sec[c + d*x] + C*Sec[c + d*x]^2))/Sqrt[a + a*Sec[c + d*x]],x]

[Out]

-(((B - 2*C)*ArcTan[(Sqrt[a]*Tan[c + d*x])/Sqrt[a + a*Sec[c + d*x]]])/(Sqrt[a]*d)) + (Sqrt[2]*(B - C)*ArcTan[(
Sqrt[a]*Tan[c + d*x])/(Sqrt[2]*Sqrt[a + a*Sec[c + d*x]])])/(Sqrt[a]*d) + (B*Sin[c + d*x])/(d*Sqrt[a + a*Sec[c
+ d*x]])

Rule 209

Int[((a_) + (b_.)*(x_)^2)^(-1), x_Symbol] :> Simp[(1/(Rt[a, 2]*Rt[b, 2]))*ArcTan[Rt[b, 2]*(x/Rt[a, 2])], x] /;
 FreeQ[{a, b}, x] && PosQ[a/b] && (GtQ[a, 0] || GtQ[b, 0])

Rule 3859

Int[Sqrt[csc[(c_.) + (d_.)*(x_)]*(b_.) + (a_)], x_Symbol] :> Dist[-2*(b/d), Subst[Int[1/(a + x^2), x], x, b*(C
ot[c + d*x]/Sqrt[a + b*Csc[c + d*x]])], x] /; FreeQ[{a, b, c, d}, x] && EqQ[a^2 - b^2, 0]

Rule 3880

Int[csc[(e_.) + (f_.)*(x_)]/Sqrt[csc[(e_.) + (f_.)*(x_)]*(b_.) + (a_)], x_Symbol] :> Dist[-2/f, Subst[Int[1/(2
*a + x^2), x], x, b*(Cot[e + f*x]/Sqrt[a + b*Csc[e + f*x]])], x] /; FreeQ[{a, b, e, f}, x] && EqQ[a^2 - b^2, 0
]

Rule 4005

Int[(csc[(e_.) + (f_.)*(x_)]*(d_.) + (c_))/Sqrt[csc[(e_.) + (f_.)*(x_)]*(b_.) + (a_)], x_Symbol] :> Dist[c/a,
Int[Sqrt[a + b*Csc[e + f*x]], x], x] - Dist[(b*c - a*d)/a, Int[Csc[e + f*x]/Sqrt[a + b*Csc[e + f*x]], x], x] /
; FreeQ[{a, b, c, d, e, f}, x] && NeQ[b*c - a*d, 0] && EqQ[a^2 - b^2, 0]

Rule 4107

Int[(csc[(e_.) + (f_.)*(x_)]*(d_.))^(n_)*(csc[(e_.) + (f_.)*(x_)]*(b_.) + (a_))^(m_)*(csc[(e_.) + (f_.)*(x_)]*
(B_.) + (A_)), x_Symbol] :> Simp[A*Cot[e + f*x]*(a + b*Csc[e + f*x])^m*((d*Csc[e + f*x])^n/(f*n)), x] - Dist[1
/(b*d*n), Int[(a + b*Csc[e + f*x])^m*(d*Csc[e + f*x])^(n + 1)*Simp[a*A*m - b*B*n - A*b*(m + n + 1)*Csc[e + f*x
], x], x], x] /; FreeQ[{a, b, d, e, f, A, B, m}, x] && NeQ[A*b - a*B, 0] && EqQ[a^2 - b^2, 0] && LtQ[n, 0]

Rule 4157

Int[((a_.) + csc[(e_.) + (f_.)*(x_)]*(b_.))^(m_.)*((A_.) + csc[(e_.) + (f_.)*(x_)]*(B_.) + csc[(e_.) + (f_.)*(
x_)]^2*(C_.))*((c_.) + csc[(e_.) + (f_.)*(x_)]*(d_.))^(n_.), x_Symbol] :> Dist[1/b^2, Int[(a + b*Csc[e + f*x])
^(m + 1)*(c + d*Csc[e + f*x])^n*(b*B - a*C + b*C*Csc[e + f*x]), x], x] /; FreeQ[{a, b, c, d, e, f, A, B, C, m,
 n}, x] && EqQ[A*b^2 - a*b*B + a^2*C, 0]

Rubi steps

\begin {align*} \int \frac {\cos ^2(c+d x) \left (B \sec (c+d x)+C \sec ^2(c+d x)\right )}{\sqrt {a+a \sec (c+d x)}} \, dx &=\int \frac {\cos (c+d x) (B+C \sec (c+d x))}{\sqrt {a+a \sec (c+d x)}} \, dx\\ &=\frac {B \sin (c+d x)}{d \sqrt {a+a \sec (c+d x)}}+\frac {\int \frac {-\frac {1}{2} a (B-2 C)+\frac {1}{2} a B \sec (c+d x)}{\sqrt {a+a \sec (c+d x)}} \, dx}{a}\\ &=\frac {B \sin (c+d x)}{d \sqrt {a+a \sec (c+d x)}}-\frac {(B-2 C) \int \sqrt {a+a \sec (c+d x)} \, dx}{2 a}+(B-C) \int \frac {\sec (c+d x)}{\sqrt {a+a \sec (c+d x)}} \, dx\\ &=\frac {B \sin (c+d x)}{d \sqrt {a+a \sec (c+d x)}}+\frac {(B-2 C) \text {Subst}\left (\int \frac {1}{a+x^2} \, dx,x,-\frac {a \tan (c+d x)}{\sqrt {a+a \sec (c+d x)}}\right )}{d}-\frac {(2 (B-C)) \text {Subst}\left (\int \frac {1}{2 a+x^2} \, dx,x,-\frac {a \tan (c+d x)}{\sqrt {a+a \sec (c+d x)}}\right )}{d}\\ &=-\frac {(B-2 C) \tan ^{-1}\left (\frac {\sqrt {a} \tan (c+d x)}{\sqrt {a+a \sec (c+d x)}}\right )}{\sqrt {a} d}+\frac {\sqrt {2} (B-C) \tan ^{-1}\left (\frac {\sqrt {a} \tan (c+d x)}{\sqrt {2} \sqrt {a+a \sec (c+d x)}}\right )}{\sqrt {a} d}+\frac {B \sin (c+d x)}{d \sqrt {a+a \sec (c+d x)}}\\ \end {align*}

________________________________________________________________________________________

Mathematica [C] Result contains higher order function than in optimal. Order 4 vs. order 3 in optimal.
time = 26.98, size = 11162, normalized size = 93.80 \begin {gather*} \text {Result too large to show} \end {gather*}

Warning: Unable to verify antiderivative.

[In]

Integrate[(Cos[c + d*x]^2*(B*Sec[c + d*x] + C*Sec[c + d*x]^2))/Sqrt[a + a*Sec[c + d*x]],x]

[Out]

Result too large to show

________________________________________________________________________________________

Maple [B] Leaf count of result is larger than twice the leaf count of optimal. \(352\) vs. \(2(102)=204\).
time = 25.96, size = 353, normalized size = 2.97

method result size
default \(\frac {\left (B \sqrt {2}\, \arctanh \left (\frac {\sqrt {-\frac {2 \cos \left (d x +c \right )}{1+\cos \left (d x +c \right )}}\, \sin \left (d x +c \right ) \sqrt {2}}{2 \cos \left (d x +c \right )}\right ) \sqrt {-\frac {2 \cos \left (d x +c \right )}{1+\cos \left (d x +c \right )}}\, \sin \left (d x +c \right )-2 C \sqrt {2}\, \sqrt {-\frac {2 \cos \left (d x +c \right )}{1+\cos \left (d x +c \right )}}\, \arctanh \left (\frac {\sqrt {-\frac {2 \cos \left (d x +c \right )}{1+\cos \left (d x +c \right )}}\, \sin \left (d x +c \right ) \sqrt {2}}{2 \cos \left (d x +c \right )}\right ) \sin \left (d x +c \right )+2 B \sqrt {-\frac {2 \cos \left (d x +c \right )}{1+\cos \left (d x +c \right )}}\, \ln \left (\frac {\sqrt {-\frac {2 \cos \left (d x +c \right )}{1+\cos \left (d x +c \right )}}\, \sin \left (d x +c \right )-\cos \left (d x +c \right )+1}{\sin \left (d x +c \right )}\right ) \sin \left (d x +c \right )-2 C \sqrt {-\frac {2 \cos \left (d x +c \right )}{1+\cos \left (d x +c \right )}}\, \ln \left (\frac {\sqrt {-\frac {2 \cos \left (d x +c \right )}{1+\cos \left (d x +c \right )}}\, \sin \left (d x +c \right )-\cos \left (d x +c \right )+1}{\sin \left (d x +c \right )}\right ) \sin \left (d x +c \right )-2 B \left (\cos ^{2}\left (d x +c \right )\right )+2 B \cos \left (d x +c \right )\right ) \sqrt {\frac {a \left (1+\cos \left (d x +c \right )\right )}{\cos \left (d x +c \right )}}}{2 d \sin \left (d x +c \right ) a}\) \(353\)

Verification of antiderivative is not currently implemented for this CAS.

[In]

int(cos(d*x+c)^2*(B*sec(d*x+c)+C*sec(d*x+c)^2)/(a+a*sec(d*x+c))^(1/2),x,method=_RETURNVERBOSE)

[Out]

1/2/d*(B*2^(1/2)*arctanh(1/2*(-2*cos(d*x+c)/(1+cos(d*x+c)))^(1/2)*sin(d*x+c)/cos(d*x+c)*2^(1/2))*(-2*cos(d*x+c
)/(1+cos(d*x+c)))^(1/2)*sin(d*x+c)-2*C*2^(1/2)*(-2*cos(d*x+c)/(1+cos(d*x+c)))^(1/2)*arctanh(1/2*(-2*cos(d*x+c)
/(1+cos(d*x+c)))^(1/2)*sin(d*x+c)/cos(d*x+c)*2^(1/2))*sin(d*x+c)+2*B*(-2*cos(d*x+c)/(1+cos(d*x+c)))^(1/2)*ln((
(-2*cos(d*x+c)/(1+cos(d*x+c)))^(1/2)*sin(d*x+c)-cos(d*x+c)+1)/sin(d*x+c))*sin(d*x+c)-2*C*(-2*cos(d*x+c)/(1+cos
(d*x+c)))^(1/2)*ln(((-2*cos(d*x+c)/(1+cos(d*x+c)))^(1/2)*sin(d*x+c)-cos(d*x+c)+1)/sin(d*x+c))*sin(d*x+c)-2*B*c
os(d*x+c)^2+2*B*cos(d*x+c))*(a*(1+cos(d*x+c))/cos(d*x+c))^(1/2)/sin(d*x+c)/a

________________________________________________________________________________________

Maxima [F]
time = 0.00, size = 0, normalized size = 0.00 \begin {gather*} \text {Failed to integrate} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(cos(d*x+c)^2*(B*sec(d*x+c)+C*sec(d*x+c)^2)/(a+a*sec(d*x+c))^(1/2),x, algorithm="maxima")

[Out]

integrate((C*sec(d*x + c)^2 + B*sec(d*x + c))*cos(d*x + c)^2/sqrt(a*sec(d*x + c) + a), x)

________________________________________________________________________________________

Fricas [A]
time = 4.53, size = 458, normalized size = 3.85 \begin {gather*} \left [\frac {2 \, B \sqrt {\frac {a \cos \left (d x + c\right ) + a}{\cos \left (d x + c\right )}} \cos \left (d x + c\right ) \sin \left (d x + c\right ) - \sqrt {2} {\left ({\left (B - C\right )} a \cos \left (d x + c\right ) + {\left (B - C\right )} a\right )} \sqrt {-\frac {1}{a}} \log \left (\frac {2 \, \sqrt {2} \sqrt {\frac {a \cos \left (d x + c\right ) + a}{\cos \left (d x + c\right )}} \sqrt {-\frac {1}{a}} \cos \left (d x + c\right ) \sin \left (d x + c\right ) + 3 \, \cos \left (d x + c\right )^{2} + 2 \, \cos \left (d x + c\right ) - 1}{\cos \left (d x + c\right )^{2} + 2 \, \cos \left (d x + c\right ) + 1}\right ) + {\left ({\left (B - 2 \, C\right )} \cos \left (d x + c\right ) + B - 2 \, C\right )} \sqrt {-a} \log \left (\frac {2 \, a \cos \left (d x + c\right )^{2} + 2 \, \sqrt {-a} \sqrt {\frac {a \cos \left (d x + c\right ) + a}{\cos \left (d x + c\right )}} \cos \left (d x + c\right ) \sin \left (d x + c\right ) + a \cos \left (d x + c\right ) - a}{\cos \left (d x + c\right ) + 1}\right )}{2 \, {\left (a d \cos \left (d x + c\right ) + a d\right )}}, \frac {B \sqrt {\frac {a \cos \left (d x + c\right ) + a}{\cos \left (d x + c\right )}} \cos \left (d x + c\right ) \sin \left (d x + c\right ) + {\left ({\left (B - 2 \, C\right )} \cos \left (d x + c\right ) + B - 2 \, C\right )} \sqrt {a} \arctan \left (\frac {\sqrt {\frac {a \cos \left (d x + c\right ) + a}{\cos \left (d x + c\right )}} \cos \left (d x + c\right )}{\sqrt {a} \sin \left (d x + c\right )}\right ) - \frac {\sqrt {2} {\left ({\left (B - C\right )} a \cos \left (d x + c\right ) + {\left (B - C\right )} a\right )} \arctan \left (\frac {\sqrt {2} \sqrt {\frac {a \cos \left (d x + c\right ) + a}{\cos \left (d x + c\right )}} \cos \left (d x + c\right )}{\sqrt {a} \sin \left (d x + c\right )}\right )}{\sqrt {a}}}{a d \cos \left (d x + c\right ) + a d}\right ] \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(cos(d*x+c)^2*(B*sec(d*x+c)+C*sec(d*x+c)^2)/(a+a*sec(d*x+c))^(1/2),x, algorithm="fricas")

[Out]

[1/2*(2*B*sqrt((a*cos(d*x + c) + a)/cos(d*x + c))*cos(d*x + c)*sin(d*x + c) - sqrt(2)*((B - C)*a*cos(d*x + c)
+ (B - C)*a)*sqrt(-1/a)*log((2*sqrt(2)*sqrt((a*cos(d*x + c) + a)/cos(d*x + c))*sqrt(-1/a)*cos(d*x + c)*sin(d*x
 + c) + 3*cos(d*x + c)^2 + 2*cos(d*x + c) - 1)/(cos(d*x + c)^2 + 2*cos(d*x + c) + 1)) + ((B - 2*C)*cos(d*x + c
) + B - 2*C)*sqrt(-a)*log((2*a*cos(d*x + c)^2 + 2*sqrt(-a)*sqrt((a*cos(d*x + c) + a)/cos(d*x + c))*cos(d*x + c
)*sin(d*x + c) + a*cos(d*x + c) - a)/(cos(d*x + c) + 1)))/(a*d*cos(d*x + c) + a*d), (B*sqrt((a*cos(d*x + c) +
a)/cos(d*x + c))*cos(d*x + c)*sin(d*x + c) + ((B - 2*C)*cos(d*x + c) + B - 2*C)*sqrt(a)*arctan(sqrt((a*cos(d*x
 + c) + a)/cos(d*x + c))*cos(d*x + c)/(sqrt(a)*sin(d*x + c))) - sqrt(2)*((B - C)*a*cos(d*x + c) + (B - C)*a)*a
rctan(sqrt(2)*sqrt((a*cos(d*x + c) + a)/cos(d*x + c))*cos(d*x + c)/(sqrt(a)*sin(d*x + c)))/sqrt(a))/(a*d*cos(d
*x + c) + a*d)]

________________________________________________________________________________________

Sympy [F]
time = 0.00, size = 0, normalized size = 0.00 \begin {gather*} \int \frac {\left (B + C \sec {\left (c + d x \right )}\right ) \cos ^{2}{\left (c + d x \right )} \sec {\left (c + d x \right )}}{\sqrt {a \left (\sec {\left (c + d x \right )} + 1\right )}}\, dx \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(cos(d*x+c)**2*(B*sec(d*x+c)+C*sec(d*x+c)**2)/(a+a*sec(d*x+c))**(1/2),x)

[Out]

Integral((B + C*sec(c + d*x))*cos(c + d*x)**2*sec(c + d*x)/sqrt(a*(sec(c + d*x) + 1)), x)

________________________________________________________________________________________

Giac [B] Leaf count of result is larger than twice the leaf count of optimal. 365 vs. \(2 (102) = 204\).
time = 1.90, size = 365, normalized size = 3.07 \begin {gather*} -\frac {\frac {\sqrt {2} {\left (B - C\right )} \log \left ({\left (\sqrt {-a} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right ) - \sqrt {-a \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{2} + a}\right )}^{2}\right )}{\sqrt {-a} \mathrm {sgn}\left (\cos \left (d x + c\right )\right )} + \frac {{\left (B - 2 \, C\right )} \log \left ({\left | {\left (\sqrt {-a} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right ) - \sqrt {-a \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{2} + a}\right )}^{2} - a {\left (2 \, \sqrt {2} + 3\right )} \right |}\right )}{\sqrt {-a} \mathrm {sgn}\left (\cos \left (d x + c\right )\right )} - \frac {{\left (B - 2 \, C\right )} \log \left ({\left | {\left (\sqrt {-a} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right ) - \sqrt {-a \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{2} + a}\right )}^{2} + a {\left (2 \, \sqrt {2} - 3\right )} \right |}\right )}{\sqrt {-a} \mathrm {sgn}\left (\cos \left (d x + c\right )\right )} + \frac {4 \, \sqrt {2} {\left (3 \, {\left (\sqrt {-a} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right ) - \sqrt {-a \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{2} + a}\right )}^{2} B \sqrt {-a} - B \sqrt {-a} a\right )}}{{\left ({\left (\sqrt {-a} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right ) - \sqrt {-a \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{2} + a}\right )}^{4} - 6 \, {\left (\sqrt {-a} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right ) - \sqrt {-a \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{2} + a}\right )}^{2} a + a^{2}\right )} \mathrm {sgn}\left (\cos \left (d x + c\right )\right )}}{2 \, d} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(cos(d*x+c)^2*(B*sec(d*x+c)+C*sec(d*x+c)^2)/(a+a*sec(d*x+c))^(1/2),x, algorithm="giac")

[Out]

-1/2*(sqrt(2)*(B - C)*log((sqrt(-a)*tan(1/2*d*x + 1/2*c) - sqrt(-a*tan(1/2*d*x + 1/2*c)^2 + a))^2)/(sqrt(-a)*s
gn(cos(d*x + c))) + (B - 2*C)*log(abs((sqrt(-a)*tan(1/2*d*x + 1/2*c) - sqrt(-a*tan(1/2*d*x + 1/2*c)^2 + a))^2
- a*(2*sqrt(2) + 3)))/(sqrt(-a)*sgn(cos(d*x + c))) - (B - 2*C)*log(abs((sqrt(-a)*tan(1/2*d*x + 1/2*c) - sqrt(-
a*tan(1/2*d*x + 1/2*c)^2 + a))^2 + a*(2*sqrt(2) - 3)))/(sqrt(-a)*sgn(cos(d*x + c))) + 4*sqrt(2)*(3*(sqrt(-a)*t
an(1/2*d*x + 1/2*c) - sqrt(-a*tan(1/2*d*x + 1/2*c)^2 + a))^2*B*sqrt(-a) - B*sqrt(-a)*a)/(((sqrt(-a)*tan(1/2*d*
x + 1/2*c) - sqrt(-a*tan(1/2*d*x + 1/2*c)^2 + a))^4 - 6*(sqrt(-a)*tan(1/2*d*x + 1/2*c) - sqrt(-a*tan(1/2*d*x +
 1/2*c)^2 + a))^2*a + a^2)*sgn(cos(d*x + c))))/d

________________________________________________________________________________________

Mupad [F]
time = 0.00, size = -1, normalized size = -0.01 \begin {gather*} \int \frac {{\cos \left (c+d\,x\right )}^2\,\left (\frac {B}{\cos \left (c+d\,x\right )}+\frac {C}{{\cos \left (c+d\,x\right )}^2}\right )}{\sqrt {a+\frac {a}{\cos \left (c+d\,x\right )}}} \,d x \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

int((cos(c + d*x)^2*(B/cos(c + d*x) + C/cos(c + d*x)^2))/(a + a/cos(c + d*x))^(1/2),x)

[Out]

int((cos(c + d*x)^2*(B/cos(c + d*x) + C/cos(c + d*x)^2))/(a + a/cos(c + d*x))^(1/2), x)

________________________________________________________________________________________